package com.wangmei.config;

import com.mangofactory.swagger.plugin.EnableSwagger;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class SwiggerConfig {
    @Bean
    public Docket userApi(){
        return new Docket(DocumentationType.SWAGGER_2)
        .select()// 选择那些路径和api会生成document
        .apis(RequestHandlerSelectors.any()) // 对所有api进行监控
        .paths(PathSelectors.any()) // 对所有路径进行监�?
        .build();

    }
    @Bean
    public RequestMappingInfoHandlerMapping requestMapping(){
        return new RequestMappingHandlerMapping();
    }
}
